package com.wuyan.authorization.service;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 安全用户模型
 *
 * @author mrwang
 */
public class JwtUserDetails extends User {


	private static final long serialVersionUID = 3712032583494285133L;

	@Getter
	private Long userId;

	@Getter
	private Boolean isAdmin;

	public JwtUserDetails(Long userId, Boolean isAdmin, String username, String password, Collection<? extends GrantedAuthority> authorities) {
		this(userId, isAdmin, username, password, true, true, true, true, authorities);
	}

	public JwtUserDetails(Long userId, Boolean isAdmin, String username, String password, boolean enabled, boolean accountNonExpired,
						  boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
		this.userId = userId;
		this.isAdmin = isAdmin;
	}

}